﻿//https://www.nowcoder.com/questionTerminal/bb4f1a23dbb84fd7b77be1fbe9eaaf32
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s1, s2;
	while (cin >> s1 >> s2) // 未知组数的输⼊
	{
		int hash[26] = { 0 };
		for (auto ch : s1) hash[ch - 'A']++;
		bool ret = true;
		for (auto ch : s2)
		{
			if (--hash[ch - 'A'] < 0)
			{
				ret = false;
				break;
			}
		}
		cout << (ret ? "Yes" : "No") << endl;
	}
	return 0;
}

//https://www.nowcoder.com/questionTerminal/6736cc3ffd1444a4a0057dee89be789b

#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;
const int N = 1e5 + 10;
int n;
LL arr[N * 3];
int main()
{
	cin >> n;
	for (int i = 0; i < 3 * n; i++) cin >> arr[i];
	sort(arr, arr + 3 * n);
	int pos = 3 * n - 2, count = 1;
	LL ret = 0;
	while (count++ <= n)
	{
		ret += arr[pos];
		pos -= 2;
	}
	cout << ret << endl;
	return 0;
}

//https://www.nowcoder.com/practice/3bcf72c738b6494bbe1ebe0ffde56152?tpId=230&tqId=40419&ru=/exam/oj

#include <iostream>
using namespace std;
const int N = 1e4 + 10;
int sum[N]; // sum[i] 表⽰ i 出现的总和
int n;
int f[N], g[N];
int main()
{
	cin >> n;
	int x;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		sum[x] += x;
	}
	for (int i = 1; i < N; i++)
	{
		f[i] = g[i - 1] + sum[i];
		g[i] = max(f[i - 1], g[i - 1]);
	}
	cout << max(f[N - 1], g[N - 1]) << endl;
	return 0;
}